#include "NoiseTexture.h"

NoiseTexture::NoiseTexture(float _scale /* = 1.0f */)
{
	scale = _scale;
	c0 = rgb(0.8f, 0.0f, 0.0f);
	c1 = rgb(0.0f, 0.0f, 0.8f);
}

NoiseTexture::NoiseTexture(const rgb& _c0, const rgb& _c1, float _scale /* = 1.0f */)
	: c0(_c0), c1(_c1), scale(_scale)
{

}

rgb NoiseTexture::value(const Vector2& uv, const Vector3& p) const
{
	float t = (1.0f + solid_noise.noise(p * scale)) / 2.0f;
	return t * c0 + (1.0f - t) * c1;
}